Check out the code of this app in GitHub