Major refactoring of the script

Now that the function is more clear I adjusted the code. Set to work as
a standalone script and a module. Objects organized in classes that can
be instantiated independently if needed. Consists of a search and a
package class and a main function for the command line. It still only
fetches the summary; soon it will fetch the full metadata record.