Converted anther call from imperative to functional and added more statement caching