Fixed bug and added functional visualization test