basic implementation done, need to clean code