Add specs and lib
inline temp variables to make code more readable
add additional spec