Continued refactoring and work on stocks