Upgrading to standard structure and adding tests