My solution for SICP