initial version, still with bugs