Refactor and add a way to get pixel