cleaned up backend code.