Modified and refactored files inside lib directory