alter code to better fit previous style