better solutions for some problems