refactor complete, basic operations tested and working