Fixed Issue #23, refactor, renamed variables