Better working, needs cleanup