changed 'and' to '&&' where appropriate