refactoring code to change database input method
holy fuck