Added mask processing