Moved display js logic to a more OO appoach