Added unit and automatic tests