Cleaned up warnings and unused code