Tests added and some slight modification introduced