removed direct access to variables, made some code better at self documenting