Cleaning up and fixing some minor issues

Some TODO comments added at the end of code, for future reference