Re-factored code for consistency, prototype towards module goal