2nd commit: improved code