- fixed black pixel bug and refactored

Signed-off-by: G A <gdur.mugen@googlemail.com>