Convert function to class

Ported function into class and added the ability to both register and
enqueue from the class. Added a safe argument to check if source file
exists before enqueuing.