made backend code more concise