Refactored basecode and minitest passing