First two problem implemented