Move classes into lib directory

It's not sustainable to keep all classes in one single file. As more
scripts are added that want to use that functionality it is better to
move them to individual class files in a library directory. Separate
each class into a .pm file.

Signed-off-by: Marcus Karlsson <mk@acc.umu.se>