Cleaned up the code & added complexity option