Implemented TextureView and refactored code