- re-factored some functionality.