Cleaned up code now that everything is working