added personal function library & cleaned up