majority of back-end logic done