integrate the front and back ends and refactor