My humble implementation of homework no. 1