Got rid of an extra function
Added some basic caching