Modified output function, added entry limit