tried to implement sorting but failed :-(