Started porting some functions.