Slowly porting over code from BitBucket.