Fixed database bug
refactored most of code. still missing json code and menu code in classes