Abstract unary function, added year function, fixed a bug that caused aliases in group by to be malformed.