minor refactors
still working on security