followed hints and made code more strict