code improvements and resolved linux build errors