Adding lib.js with validation function, refactoring sprite to use it