removed nested let statements, much cleaner and easier to read now.