Implemented new API in page.js

See, the code size is much smaller now :)