Code review and fine tuning, ready for compilation