core logic moved to client js