Solution to first week's assignment