Cleaned up code and added used libraries