refactor: move ar functions from application.js to realspace.js