Remove unused library
Separate general function definitions to a separate file