Updated to better Rails syntax