Resolving programming assignment 2