overhaul of js logic and backend request