Added code from bitbucket