add instantiations and moved if else statements