minor refactor on frontend, major refactor on backend