Version3, needs cleanup but no known bugs