Code clean up. Ready to merge master for minor changes