add users function, fix database function, add main functions