Cleaned up level code