Moved query -> JS