removed useless code
generating mask dynamically