Major code clean up, added implementations