Code cleanup

Cleared the warnings and removed some useless code