finished intersection code