Added functions to count bricks and check for all required bricks.