Working except for ugly output