Splitted into a main script and a library class