code cleanup, var rename, unused line del, comments
rewrite for ap discovery