Added libraries and code clean up