finished code clean up and closed #46