Added API mode, JS dynamic page loading and some bug fixes