made main stuff static to simplify