Fixing compilation and cleaning up