added specs & made code readable a bit