lots of changed based on Rupok bhaiya's suggestion