cleaned up backend code