cleanup all and wait to rewrite in a better way with dynamic data structure