libraries refactored to be more standard