Improved interface funtions, cleaned code.