Moved sites api to its own file. Refactor for #19