Some code cleanup, refactored variables and updated the library to v1.3