Added abstraction and some functions.