Windows version of homework 2 (final version)