Added lazy store. Cleaned up some code