Fixed edge case bug and added bar size parameter