fixed bug in first problem; completed second problem