moved js to separate file, moved database to separate file