refractoring to adhere to Scala style guides