Cleaned up the code, removed extra useless code.