Added basic functions from HW1 solutions