added some todos and cleaned up code