Added more functionality. Sorry for bad commit messages.