added api and moved code to main src directory