increase portability
clean and encapsulate somewhat