Fixed definition
Moved library files, enhanced library function