#2 refactoring done and finished testing